/*
 * @Author: CodeHare
 * @Date: 2023-09-19 18:46:23
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-04 09:52:38
 * @Description: 电池保护参数设置
 */
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:yt_devops/resources/str_res_keys.dart';

class RectangleBatteryProtectionParameterModel {
  /// 指令集Socket值
  late Map socketMap = {};

  /// 参数设置Map
  late Map<String, ParameterInfoItem>? parameterMap;

  /// 过充保护控制器
  final overchargeProtection = TextEditingController();

  /// 过充释放控制器
  final overchargeRelease = TextEditingController();

  /// 过放保护控制器
  final overDischargeProtection = TextEditingController();

  /// 过放释放控制器
  final overrelease = TextEditingController();

  /// 电池保护参数设置
  Map<String, ParameterInfoItem> generateParameterList() {
    const unit = 'V';

    return <String, ParameterInfoItem>{
      "1": ParameterInfoItem(
        ' ${'siteMonitor.overchargeProtection'.tr}', //'过充保护'
        unit,
        overchargeProtection,
        '',
      ),
      "2": ParameterInfoItem(
        ' ${'siteMonitor.overchargeRelease'.tr}', //过充释放
        unit,
        overchargeRelease,
        '',
      ),
      "3": ParameterInfoItem(
        ' ${'siteMonitor.overDischargeProtection'.tr}', //过充保护
        unit,
        overDischargeProtection,
        '',
      ),
      "4": ParameterInfoItem(
        ' ${'siteMonitor.overrelease'.tr}', //过放释放
        unit,
        overrelease,
        '',
      ),
    };
  }
}

class ParameterInfoItem {
  /// 描述
  String label;

  /// 单位
  String unit;

  /// 控制器
  TextEditingController textEditingController;

  /// 错误提示
  String error;

  ParameterInfoItem(
    this.label,
    this.unit,
    this.textEditingController,
    this.error,
  );
}
